//
//  SYS_SuitIconAndTextView.m
//  System_App
//
//  Created by 魏配军 on 2017/12/5.
//  Copyright © 2017年 czy001. All rights reserved.
//

#import "SYS_SuitIconAndTextView.h"

@implementation SYS_SuitIconAndTextView

-(instancetype)initWithFrame:(CGRect)frame
{
    self=[super initWithFrame:frame];
    if (self) {
        [self addView];
    }
    return self;
}

-(void) addView
{
    _iconImageView=[UIImageView new];
    
    _nameLabel=[[UILabel alloc]init];
    _nameLabel.textColor=DGHColor(20, 20, 20);
    _nameLabel.textAlignment=NSTextAlignmentLeft;
    _nameLabel.font=[UIFont fontWithName:@"PingFangSC-Regular" size:13];
    
    [self sd_addSubviews:@[_iconImageView,_nameLabel]];
    
    _iconImageView.sd_layout
    .leftSpaceToView(self, 30)
    .topSpaceToView(self, 10)
    .widthIs(20)
    .heightIs(20);
    
    _nameLabel.sd_layout
    .leftSpaceToView(_iconImageView, 10)
    .topSpaceToView(self, 10)
    .widthIs(60)
    .heightIs(20);
    
    
}
-(void)setIsSetFrame:(BOOL)isSetFrame
{
    _iconImageView.sd_layout
    .leftSpaceToView(self, 20)
    .topSpaceToView(self, 10)
    .widthIs(30)
    .heightIs(20);
    
    _nameLabel.sd_layout
    .leftSpaceToView(_iconImageView, 10)
    .topSpaceToView(self, 10)
    .widthIs(60)
    .heightIs(20);
}

-(void)setIsAdjustPosition:(BOOL)isAdjustPosition
{
    _nameLabel.textAlignment=NSTextAlignmentCenter;
    _nameLabel.textColor=DGHColor(100, 100, 100);

    _iconImageView.sd_layout
    .leftSpaceToView(self, (self.width-25)/2)
    .topSpaceToView(self, 5)
    .widthIs(25)
    .heightIs(25);
    
    _nameLabel.sd_layout
    .leftSpaceToView(self, 10)
    .topSpaceToView(_iconImageView, 10)
    .widthIs(self.width-20)
    .heightIs(20);
    
}

-(void)setIsAdjustIconPosittion:(BOOL)isAdjustIconPosittion
{
    _nameLabel.textAlignment=NSTextAlignmentCenter;
    _nameLabel.textColor=DGHColor(100, 100, 100);
    
    _iconImageView.sd_layout
    .leftSpaceToView(self, (self.width-30)/2)
    .topSpaceToView(self, 5)
    .widthIs(30)
    .heightIs(20);
    
    _nameLabel.sd_layout
    .leftSpaceToView(self, 10)
    .topSpaceToView(_iconImageView, 10)
    .widthIs(self.width-20)
    .heightIs(20);
}


@end
